/*
 * PlayerView.java
 *
 * Created on November 25, 2007, 9:42 PM
 */

package bbos.Match.Views;

import bbos.Match.Model.dPlayer;
import bbos.*;
import java.net.*;
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.awt.event.*;
/**
 *
 * @author  moi
 */
public class jpnPlayer extends javax.swing.JPanel {
    
    dPlayer _player=null;
    
    /** Creates new form PlayerView */
    public jpnPlayer() {
        initComponents();
    }
    
    public void setPlayer(dPlayer player)
    {
        _player=player;
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jlbPlayerPicture = new javax.swing.JLabel();
        jpnSubPanelPLayer = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jpnCaracCurrentPlayer = new javax.swing.JPanel();
        jlbLabelMove = new javax.swing.JLabel();
        jlbLabelStrength = new javax.swing.JLabel();
        jlbLabelAgility = new javax.swing.JLabel();
        jlbLabelArmor = new javax.swing.JLabel();
        jlbMoveValue = new javax.swing.JLabel();
        jlbStrengthValue = new javax.swing.JLabel();
        jlbAgilityValue = new javax.swing.JLabel();
        jlbArmorValue = new javax.swing.JLabel();
        jpnOfficialPlayer = new javax.swing.JPanel();
        jlbPlayerName = new javax.swing.JLabel();
        jlbPlayerNumber = new javax.swing.JLabel();
        jlbPosition = new javax.swing.JLabel();
        jlbCompetences = new javax.swing.JLabel();

        setBackground(java.awt.Color.white);
        setBorder(javax.swing.BorderFactory.createTitledBorder("Selected Player"));
        setFocusable(false);
        setMaximumSize(new java.awt.Dimension(214, 150));
        setMinimumSize(new java.awt.Dimension(214, 150));
        setPreferredSize(new java.awt.Dimension(214, 150));
        setLayout(new java.awt.BorderLayout());

        jlbPlayerPicture.setBackground(new java.awt.Color(255, 255, 255));
        jlbPlayerPicture.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jlbPlayerPicture.setPreferredSize(new java.awt.Dimension(100, 150));
        add(jlbPlayerPicture, java.awt.BorderLayout.EAST);

        jpnSubPanelPLayer.setBackground(java.awt.Color.white);
        jpnSubPanelPLayer.setPreferredSize(new java.awt.Dimension(80, 80));
        jpnSubPanelPLayer.setRequestFocusEnabled(false);
        jpnSubPanelPLayer.setLayout(new java.awt.BorderLayout());

        jPanel1.setPreferredSize(new java.awt.Dimension(70, 80));
        jPanel1.setLayout(new java.awt.BorderLayout());

        jpnCaracCurrentPlayer.setBackground(java.awt.Color.white);
        jpnCaracCurrentPlayer.setForeground(java.awt.Color.red);
        jpnCaracCurrentPlayer.setMinimumSize(new java.awt.Dimension(70, 37));
        jpnCaracCurrentPlayer.setLayout(new java.awt.GridLayout(2, 4, 3, 3));

        jlbLabelMove.setBackground(new java.awt.Color(255, 255, 255));
        jlbLabelMove.setFont(new java.awt.Font("Arial", 1, 14));
        jlbLabelMove.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbLabelMove.setText("M");
        jpnCaracCurrentPlayer.add(jlbLabelMove);

        jlbLabelStrength.setBackground(new java.awt.Color(255, 255, 255));
        jlbLabelStrength.setFont(new java.awt.Font("Arial", 1, 14));
        jlbLabelStrength.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbLabelStrength.setText("S");
        jpnCaracCurrentPlayer.add(jlbLabelStrength);

        jlbLabelAgility.setFont(new java.awt.Font("Tahoma", 1, 14));
        jlbLabelAgility.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbLabelAgility.setText("Ag");
        jpnCaracCurrentPlayer.add(jlbLabelAgility);

        jlbLabelArmor.setFont(new java.awt.Font("Arial", 1, 14));
        jlbLabelArmor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbLabelArmor.setText("Ar");
        jpnCaracCurrentPlayer.add(jlbLabelArmor);

        jlbMoveValue.setBackground(new java.awt.Color(255, 255, 255));
        jlbMoveValue.setFont(new java.awt.Font("Arial", 3, 14));
        jlbMoveValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbMoveValue.setText("9");
        jpnCaracCurrentPlayer.add(jlbMoveValue);

        jlbStrengthValue.setFont(new java.awt.Font("Arial", 3, 14));
        jlbStrengthValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbStrengthValue.setText("4");
        jpnCaracCurrentPlayer.add(jlbStrengthValue);

        jlbAgilityValue.setFont(new java.awt.Font("Arial", 3, 14));
        jlbAgilityValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbAgilityValue.setText("5");
        jpnCaracCurrentPlayer.add(jlbAgilityValue);

        jlbArmorValue.setFont(new java.awt.Font("Arial", 3, 14));
        jlbArmorValue.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbArmorValue.setText("6");
        jpnCaracCurrentPlayer.add(jlbArmorValue);

        jPanel1.add(jpnCaracCurrentPlayer, java.awt.BorderLayout.SOUTH);

        jpnOfficialPlayer.setBackground(java.awt.Color.white);
        jpnOfficialPlayer.setPreferredSize(new java.awt.Dimension(80, 30));
        jpnOfficialPlayer.setLayout(new java.awt.BorderLayout());

        jlbPlayerName.setBackground(java.awt.Color.white);
        jlbPlayerName.setFont(new java.awt.Font("Tahoma", 1, 12));
        jlbPlayerName.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbPlayerName.setText("Player Name");
        jlbPlayerName.setPreferredSize(new java.awt.Dimension(70, 15));
        jpnOfficialPlayer.add(jlbPlayerName, java.awt.BorderLayout.NORTH);

        jlbPlayerNumber.setBackground(java.awt.Color.white);
        jlbPlayerNumber.setText("# 0");
        jpnOfficialPlayer.add(jlbPlayerNumber, java.awt.BorderLayout.WEST);

        jlbPosition.setBackground(java.awt.Color.white);
        jlbPosition.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbPosition.setText("Lineman");
        jlbPosition.setPreferredSize(new java.awt.Dimension(40, 15));
        jpnOfficialPlayer.add(jlbPosition, java.awt.BorderLayout.CENTER);

        jPanel1.add(jpnOfficialPlayer, java.awt.BorderLayout.NORTH);

        jpnSubPanelPLayer.add(jPanel1, java.awt.BorderLayout.NORTH);

        jlbCompetences.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jlbCompetences.setText("Competences");
        jlbCompetences.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jlbCompetences.setPreferredSize(new java.awt.Dimension(100, 15));
        jpnSubPanelPLayer.add(jlbCompetences, java.awt.BorderLayout.WEST);

        add(jpnSubPanelPLayer, java.awt.BorderLayout.CENTER);
    }// </editor-fold>//GEN-END:initComponents
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel jPanel1;
    private javax.swing.JLabel jlbAgilityValue;
    private javax.swing.JLabel jlbArmorValue;
    private javax.swing.JLabel jlbCompetences;
    private javax.swing.JLabel jlbLabelAgility;
    private javax.swing.JLabel jlbLabelArmor;
    private javax.swing.JLabel jlbLabelMove;
    private javax.swing.JLabel jlbLabelStrength;
    private javax.swing.JLabel jlbMoveValue;
    private javax.swing.JLabel jlbPlayerName;
    private javax.swing.JLabel jlbPlayerNumber;
    private javax.swing.JLabel jlbPlayerPicture;
    private javax.swing.JLabel jlbPosition;
    private javax.swing.JLabel jlbStrengthValue;
    private javax.swing.JPanel jpnCaracCurrentPlayer;
    private javax.swing.JPanel jpnOfficialPlayer;
    private javax.swing.JPanel jpnSubPanelPLayer;
    // End of variables declaration//GEN-END:variables
    
    public void paint(Graphics g)
    { 
        super.paint(g) ;

        if (_player!=null)
        {
            jlbAgilityValue.setText (_player.getStringAgility ());
            jlbArmorValue.setText (_player.getStringArmor ());
            jlbMoveValue.setText (_player.getStringMovement ());
            jlbStrengthValue.setText (_player.getStringStrength ());
            //jlbPlayerPicture.setIcon (new ImageIcon(getToolkit().getImage(getClass().getResource(_player.getPictureUrl()))));
            jlbPlayerNumber.setText (" # "+Integer.toString (_player.getNumber()));
            jlbPosition.setText (_player.getPosition());
            jlbPlayerName.setText (_player.getName());
        }
        else
        {
             jlbAgilityValue.setText ("");
            jlbArmorValue.setText ("");
            jlbMoveValue.setText ("");
            jlbStrengthValue.setText ("");
            jlbPlayerPicture.setIcon (null);
            jlbPlayerNumber.setText ("");
            jlbPosition.setText ("");
            jlbPlayerName.setText ("");
        }

    }
}
